package junior.sample.support.db.option;

import junior.db.dao.update.DeleteOption;
import junior.sample.support.db.annotation.LogicDelete;
import org.springframework.core.annotation.AnnotationUtils;

/**
 * @author wubo
 * @date 2024/9/2 14:36
 */
public class D extends DeleteOption {

    @Override
    public void beforeExecuteNode() {
        super.beforeExecuteNode();
        this.initDeleteField();
    }
    
    protected void initDeleteField() {
        if (logicDeleteField == null && this.entityClass != null) {
            if (AnnotationUtils.findAnnotation(this.entityClass, LogicDelete.class) != null) {
                super.withLogicDelete("isDeleted", Integer.valueOf(1));
            }
        }
    }
}
